package com.question.Design;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

import com.question.utils.InputOutUtils;
import com.question.view.Application;
import com.question.view.command.ICommand;

public class NotLoginProxy implements InvocationHandler{

	private ICommand subject;
	public void setSubject(ICommand subject) {
		this.subject = subject;
	}
	
	@Override
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
		if(Application.getUser() != null) {
			InputOutUtils.print("你已经登陆了无法再进行这项操作");
			return null;
		}
		method.invoke(subject,args);
		return null;
	}
	

}
